package com.zjs.servlet;

import com.zjs.bean.Grade;
import com.zjs.service.GradeService;
import com.zjs.service.impl.GradeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(urlPatterns = {"/grade"})
public class GradeServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取数据
        GradeService gradeService = new GradeServiceImpl();
        List<Grade> grades = gradeService.list();
        req.setAttribute("grades", grades);
        req.getRequestDispatcher("/Educational/student/add.jsp").forward(req, resp);
    }
}
